import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/orders/list',
    method: 'get',
    params: query
  })
}


export function del(id) {
  return request({
    url: '/orders/delete/' + id,
    method: 'delete'
  })
}


export function add(data) {
  return request({
    url: '/orders/add',
    method: 'post',
    data
  })
}

// export function del(id) {
//   return request({
//     url: '/app/backendUser/delete/' + id,
//     method: 'delete'
//   })
// }

// export function update(data) {
//   return request({
//     url: '/orders/update',
//     method: 'PUT',
//     data
//   })
// }

// export function add(data) {
//   return request({
//     url: '/app/backendUser/add',
//     method: 'post',
//     data
//   })
// }

export function update(data) {
  return request({
    url: '/orders/update',
    method: 'PUT',
    data
  })
}

export function logOut(data) {
  return request({
    url: '/app/backendUser/editStatus',
    method: 'PUT',
    data
  })
}


export function fetchArticle(id) {
  return request({
    url: '/vue-element-admin/article/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export function fetchPv(pv) {
  return request({
    url: '/vue-element-admin/article/pv',
    method: 'get',
    params: {
      pv
    }
  })
}

/* 文件上传 */
export function uploadImg(data) {
  return request({
    method: 'post',
    type: 'upload',
    url: '/app/backendUser/upload',
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data
  })
}

export function createArticle(data) {
  return request({
    url: '/vue-element-admin/article/create',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return request({
    url: '/vue-element-admin/article/update',
    method: 'post',
    data
  })
}
